import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '../layout/index'

const routes = [
  {
    path: '/login',
    component: () => import('@/views/login.vue'),
    meta: {
      title: '登录',
      isMenu: false,
    }
  },
  {
    path:'/',
    component: Layout,
    redirect: '/home',
    meta: {
      title: '首页',
      isMenu: true
    },
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: { 
          title: '首页', icon: 'el-icon-s-home', affix: true 
        }
      },
      {
        path:'/menu',
        component: Layout,
        redirect: '/menuOne',
        meta: { 
          title: '菜单', icon: 'el-icon-s-home',  isMenu: true
        },
        children: [
          {
            path: '/menuTwo',
            name: '菜单一',
            component: () => import('@/views/home/index.vue'),
            meta: { 
              title: '', icon: 'el-icon-s-home', isMenu: true 
            }
          },
          
          {
            path: '/menuThree',
            name: '菜单二',
            component: () => import('@/views/home/index.vue'),
            meta: { 
              title: '', icon: 'el-icon-s-home', isMenu: true 
            }
          }
        ]
      }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
